const mysql = require('mysql')
const pool = mysql.createPool({
    connectionLimit: 10,
    host: 'localhost',
    user: 'root',
    password: 'root',
    database: 'taste_food'
})

module.exports.Query = (sql, value) => {
    return new Promise((resolve, reject) => {
        pool.getConnection(function (err, connection) {
            if (err) throw err; // not connected!
            connection.query(sql, value, function (error, results, fields) {
                connection.release();
                if (error) throw error;
                resolve(results)
            });
        });

    })
}
